package com.scalar.chiptrack.finance.proformainvoice.actioncommands;

import com.scalar.chiptrack.commons.Constants;
import com.scalar.chiptrack.actioncommands.ActionCommand;

/**
 * User: KP
 * Date: Sep 28, 2006
 * Time: 3:10:16 PM
 */
public class ProformaInvoiceActionCommandFactory implements Constants
{
    private static ProformaInvoiceActionCommandFactory sRelfactory;

    public synchronized static ProformaInvoiceActionCommandFactory getInstance()
    {
        if ( sRelfactory == null )
        {
            sRelfactory = new ProformaInvoiceActionCommandFactory();
        }
        return sRelfactory;
    }

    private ProformaInvoiceActionCommandFactory()
    {
    }

    public static ActionCommand getActionCommand( String action )
    {
        //System.out.println("{{{{{{{ ProformaInvoiceActionCommandFactory.getActionCommand--- action = " + action );

        if ( ACTION_SEARCH_NEW.equalsIgnoreCase( action ) )
        {
            return new ProformaInvoiceSearchNewCommand();
        }
        if ( "newInvoice".equalsIgnoreCase( action ) )
        {
            return new ProformaInvoiceNewCommand();
        }
        if ( ACTION_NEW.equalsIgnoreCase( action ) )
        {
           return new ProformaInvoiceLoadSalesOrderCommand();
        }
        if ( ACTION_SAVE.equalsIgnoreCase( action ) || ACTION_UPDATE.equalsIgnoreCase( action )  )
        {
            return new ProformaInvoiceSaveCommand();
        }
        if ( ACTION_SEARCH_INVOICES.equalsIgnoreCase( action ) )
        {
            return new ProformaInvoiceSearchCommand();
        }        
        if ( ACTION_MODIFY.equalsIgnoreCase( action ) || ACTION_VIEW.equalsIgnoreCase( action ) || ACTION_PRINT_VIEW.equalsIgnoreCase( action ) || ACTION_CANCEL.equalsIgnoreCase( action )  )
        {
            return new ProformaInvoiceModifyCommand();
        }

        return null;
    }

}
